package cn.xzchain.concurrency.singleton;

import cn.xzchain.concurrency.annoations.NotThreadSafe;
import lombok.extern.slf4j.Slf4j;

/**
 * @author lihang
 * @date 2018/5/7.
 * @description 懒汉模式--线程不安全
 */
@NotThreadSafe
public class Singleton1 {

    private Singleton1(){
    }

    private static Singleton1 instance = null;


    /**静态工厂模式*/
    public static Singleton1 getInstance(){
        if (instance == null){
            instance = new Singleton1();
        }
        return instance;
    }
}
